public class BubbleSortDemo {
    public static void main(String[] args) {
        int[] bubblesort=new int[]{4,2,9,5,7,3,1};
        int temp;
        for (int i=0;i<bubblesort.length-1;i++){
            for (int j=0;j<bubblesort.length-1-i;j++){
                if (bubblesort[j+1]>bubblesort[j]){
                    temp=bubblesort[j+1];
                    bubblesort[j+1]=bubblesort[j];
                    bubblesort[j]=temp;

                }

            }
        }
        for (int e:bubblesort){
            System.out.println(e);
        }
    }
    }

